package com.flot.yazb.home.moudle.message.model;

import com.flot.yazb.base.model.BModel;
import com.flot.yazb.base.model.CModel;
import com.flot.yazb.base.client.RetrofitFactory;
import com.flot.yazb.aop.stub.RMCallback;
import com.flot.yazb.aop.stub.RMResponse;
import com.flot.yazb.home.moudle.message.control.MsgApi;

import java.util.List;

/**
 * 图灵机器人model
 */
public class MessageEntityModel extends BModel{

    public static void getMsg(String id,String info, final Transit<MessageEntityModel> incubator) {
        RetrofitFactory.getInstance()
                .create(MsgApi.class)
                .getTuringInfo(id,info)
                .enqueue(new RMCallback<RMResponse<MessageEntityModel>>(incubator.getContext()) {
                    @Override
                    protected void onSuccess(RMResponse<MessageEntityModel> result) {
                        incubator.onBorn(result.content, result.code(), result.message());
                    }

                    @Override
                    protected void onFail(String errorCode, String errorInfo) {
                        incubator.onBorn(null, errorCode, errorInfo);
                    }
                });
    }


    public int type;
    public long time;
    public int code;
    public String text;
    public String url;
    public List<NewsEntity> list;


    public MessageEntityModel() {
    }

    public MessageEntityModel(int type, long time) {
        this.type = type;
        this.time = time;
        this.text = text;
    }

    public MessageEntityModel(int type, long time, String text) {
        this.type = type;
        this.time = time;
        this.text = text;
    }

    public class NewsEntity extends CModel {

        public String article;
        public String source;
        public String icon;
        public String detailurl;
    }
}
